Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(application-systems): Switching shared user profile service to use v2 users api #15300

Merged
merged 6 commits into from
Jun 24, 2024

Conversation

Ballioli
Copy link
Member

@Ballioli Ballioli commented Jun 21, 2024

...

Attach a link to issue if relevant

What

Specify what you're trying to achieve

Why

Specify why you need to achieve this

Screenshots / Gifs

Attach Screenshots / Gifs to help reviewers understand the scope of the pull request

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Formatting passes locally with my changes
  • I have rebased against main before asking for a review

Summary by CodeRabbit

  • New Features

    • Enhanced user profile retrieval process, improving the efficiency and reliability of fetching user data.
  • Bug Fixes

    • Updated user profile service to handle new parameters for improved bank information retrieval.

@Ballioli Ballioli requested a review from a team as a code owner June 21, 2024 09:25
Copy link
Contributor

coderabbitai bot commented Jun 21, 2024

Walkthrough

The recent changes primarily involve updating the UserProfileModule and UserProfileService to replace the older UserProfileApi and IslyklarApi with the newer V2UsersApi. This update includes modifying imports and constructor parameters and adjusting methods to align with the new parameters and response structures of V2UsersApi. The changes streamline the user profile management and bank info retrieval processes.

Changes

File Path Summary
libs/.../user-profile.module.ts Updated imports and providers to replace UserProfileApi and IslyklarApi with V2UsersApi. Removed IslyklarApi import and updated provide key in the providers array.
libs/.../user-profile.service.ts Altered imports to include V2UsersApi and related entities, revised constructor for V2UsersApi, modified userProfile method to accommodate new parameters and bank info handling.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Outside diff range and nitpick comments (1)
libs/application/template-api-modules/src/lib/modules/shared/api/user-profile/user-profile.module.ts (1)

Line range hint 7-34: Consider refactoring the static-only class.

The static analysis tool has flagged the use of a class (UserProfileModule) that contains only static members. This could be simplified into a function or a set of functions if the class structure is not necessary for maintaining state or leveraging class-based features.

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 3da0de4 and 4378172.

Files selected for processing (2)
  • libs/application/template-api-modules/src/lib/modules/shared/api/user-profile/user-profile.module.ts (2 hunks)
  • libs/application/template-api-modules/src/lib/modules/shared/api/user-profile/user-profile.service.ts (4 hunks)
Additional context used
Path-based instructions (2)
libs/application/template-api-modules/src/lib/modules/shared/api/user-profile/user-profile.module.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/template-api-modules/src/lib/modules/shared/api/user-profile/user-profile.service.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
Biome
libs/application/template-api-modules/src/lib/modules/shared/api/user-profile/user-profile.module.ts

[error] 7-34: Avoid classes that contain only static members. (lint/complexity/noStaticOnlyClass)

Prefer using simple functions instead of classes with only static members.

libs/application/template-api-modules/src/lib/modules/shared/api/user-profile/user-profile.service.ts

[error] 32-32: Decorators are not valid here. (parse)

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.


[error] 34-34: Decorators are not valid here. (parse)

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

Additional comments not posted (3)
libs/application/template-api-modules/src/lib/modules/shared/api/user-profile/user-profile.module.ts (1)

5-5: Replace old API with new V2UsersApi.

The changes correctly replace the old UserProfileApi with the new V2UsersApi. This aligns with the PR's objective to switch to the v2 users API. The use of a factory for creating V2UsersApi instances is appropriate, ensuring that the API configuration is encapsulated and can be easily managed.

Also applies to: 21-23

libs/application/template-api-modules/src/lib/modules/shared/api/user-profile/user-profile.service.ts (2)

2-2: Update imports and dependencies.

The updated imports and dependencies to include V2UsersApi and various utilities from @island.is/auth-nest-tools are in line with the PR's objectives. Ensure that these new dependencies are properly managed and do not introduce unnecessary coupling between components.

Also applies to: 4-7, 19-19


32-32: Duplicate: Fix decorator usage.

This comment is a duplicate of the previous one addressing the same issue with decorators.

Also applies to: 34-34

Tools
Biome

[error] 32-32: Decorators are not valid here. (parse)

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

Copy link
Member

@jonnigs jonnigs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@datadog-island-is
Copy link

Datadog Report

All test runs 3d45193 🔗

3 Total Test Services: 0 Failed, 3 Passed
🔻 Test Sessions change in coverage: 1 decreased (-0.01%), 3 no change

Test Services
Service Name Failed Known Flaky New Flaky Passed Skipped Total Time Code Coverage Change Test Service View
api 0 0 0 4 0 3.12s 1 no change Link
application-system-api 0 0 0 111 2 3m 27.34s 1 no change Link
application-template-api-modules 0 0 0 109 0 1m 46.65s 1 decreased (-0.01%) Link

🔻 Code Coverage Decreases vs Default Branch (1)

  • application-template-api-modules - jest 26.02% (-0.01%) - Details

Copy link

codecov bot commented Jun 21, 2024

Codecov Report

Attention: Patch coverage is 33.33333% with 14 lines in your changes missing coverage. Please review.

Project coverage is 37.12%. Comparing base (bc4b637) to head (dbb4db1).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #15300      +/-   ##
==========================================
- Coverage   37.13%   37.12%   -0.01%     
==========================================
  Files        6504     6504              
  Lines      132239   132239              
  Branches    37810    37808       -2     
==========================================
- Hits        49101    49100       -1     
- Misses      83138    83139       +1     
Flag Coverage Δ
api 3.47% <ø> (ø)
api-domains-driving-license 44.43% <ø> (ø)
api-domains-mortgage-certificate 35.00% <ø> (ø)
application-api-files 56.45% <ø> (ø)
application-system-api 42.14% <33.33%> (-0.01%) ⬇️
application-template-api-modules 24.22% <0.00%> (-0.01%) ⬇️
application-templates-driving-license 15.85% <ø> (ø)
application-templates-estate 11.94% <ø> (ø)
application-templates-inheritance-report 4.67% <ø> (ø)
application-templates-parental-leave 28.46% <ø> (ø)
application-ui-shell 21.62% <ø> (ø)
clients-driving-license 40.39% <ø> (ø)
clients-license-client 1.84% <ø> (ø)
clients-syslumenn 49.53% <ø> (ø)
judicial-system-api 17.95% <ø> (ø)
judicial-system-formatters 81.40% <ø> (ø)
judicial-system-message 66.06% <ø> (ø)
judicial-system-types 48.88% <ø> (ø)
judicial-system-web 28.24% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...les/shared/api/user-profile/user-profile.module.ts 100.00% <100.00%> (ø)
...es/shared/api/user-profile/user-profile.service.ts 42.85% <22.22%> (-2.39%) ⬇️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bc4b637...dbb4db1. Read the comment docs.

@Ballioli Ballioli added the automerge Merge this PR as soon as all checks pass label Jun 24, 2024
@kodiakhq kodiakhq bot merged commit 1a2734e into main Jun 24, 2024
58 checks passed
@kodiakhq kodiakhq bot deleted the feature/user-profile-v2-endpoint branch June 24, 2024 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Merge this PR as soon as all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants